/**
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

variable "prefix" {
  description = "Prefix used in resource names."
  type        = string
}

variable "project_id" {
  description = "Project id."
  type        = string
}

variable "vmw_network_config" {
  description = "VMware Engine network configuration."
  type = object({
    create      = optional(bool, true)
    description = optional(string, "Terraform-managed.")
    name        = optional(string, "default")
    network_policies = optional(map(object({
      edge_services_cidr       = string
      region                   = string
      description              = optional(string, "Terraform-managed.")
      expose_on_internet       = optional(bool)
      outbound_internet_access = optional(bool)
    })), {})
  })
  default = {}
}

variable "vmw_network_peerings" {
  description = "The network peerings towards users' VPCs or other VMware Engine networks. The key is the peering name suffix."
  type = map(object({
    peer_network                  = string
    description                   = optional(string, "Managed by Terraform.")
    peer_to_vmware_engine_network = optional(bool, false)
    routes_config = optional(object({
      export        = optional(bool, false)
      import        = optional(bool, false)
      public_export = optional(bool, false)
      public_import = optional(bool, false)
    }), {})
  }))
  default = {}
}

variable "vmw_private_cloud_configs" {
  description = "The VMware private cloud configurations. The key is the unique private cloud name suffix."
  type = map(object({
    cidr        = string
    zone        = string
    description = optional(string, "Managed by Terraform.")
    # The key is the unique additional cluster name suffix
    additional_cluster_configs = optional(map(object({
      custom_core_count = optional(number)
      node_count        = optional(number, 3)
      node_type_id      = optional(string, "standard-72")
    })), {})
    management_cluster_config = optional(object({
      custom_core_count = optional(number)
      name              = optional(string, "mgmt-cluster")
      node_count        = optional(number, 3)
      node_type_id      = optional(string, "standard-72")
    }), {})
  }))
  default = {
    pcc_one = {
      cidr = "192.168.0.0/24"
      additional_cluster_configs = {
        test-cluster-one = {
          node_type_id      = "standard-72"
          node_count        = 6
          custom_core_count = 28
        }
        test-cluster-two = {
          node_type_id      = "standard-72"
          node_count        = 4
          custom_core_count = 28
        }
      }
      zone = "europe-west8-a"
    }
  }
}
